package com.jinbei.service.impl;

import com.jinbei.domain.UserGold;
import com.jinbei.mapper.UserGoldMapper;
import com.jinbei.service.UserGoldService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author zflu
 * Created by lucky on 2018/9/17.
 */
@Service
public class UserGoldServiceImpl implements UserGoldService {

    @Autowired
    private UserGoldMapper userGoldMapper;

    /**
     * @author zflu
     * @Description   用户充值元宝记录批量新增
     * @date 2018/9/17 16:27
     * @param userGolds
     * @return int
     */
    @Transactional(rollbackFor = {Exception.class})
    @Override
    public int insertUserGoldList(List<UserGold> userGolds) throws Exception {
        return userGoldMapper.insertUserGoldList(userGolds);
    }

    /**
     * @author zflu
     * @Description  删除用户充值元宝记录，根据订单id
     * @date 2018/9/17 16:57
     * @param payId
     * @return int
     */
    @Transactional(rollbackFor = {Exception.class})
    @Override
    public int deleteUserGoldByPayId(Integer payId) throws Exception {
        return userGoldMapper.deleteUserGoldByPayId(payId);
    }

    /**
     * @author zflu
     * @Description  查询用户充值元宝记录列表
     * @date 2018/9/17 17:04
     * @param payId
     * @return java.util.List<com.jinbei.domain.UserGold>
     */
    @Override
    public List<UserGold> queryUserGoldList(Integer payId) throws Exception {
        return userGoldMapper.queryUserGoldList(payId);
    }
}
